<template>
	<om-page :title="pageTitle">
		<view class="version-info">
			<view class="version-count">
				<view class="single">
					<view class="info">
						<view class="version"><b>当前版本
						<a class="padding">
							{{ 'V' + nowVersionData.version + (nowVersionData.subVersion? ("-" + nowVersionData.subVersion) : "") }}
						</a>
						</b></view>
						<view class="date">{{nowVersionData.date}}</view>
					</view>
					<view class="des" v-if="nowVersionData.desc && nowVersionData.desc.length">
						<view>版本更新说明：</view>
						<view v-for="(item,index) in nowVersionData.desc" :key="index">
							<view>
								<text class="text-bold">{{index + 1}}</text>
								<text v-if="item.add" class="text-green padding-sm">新增</text>
								<text v-else-if="item.reno" class="text-brown padding-sm">修复</text>
								<text v-else-if="item.optimize" class="text-blue padding-sm">优化</text>
								<text>{{item.desc}}</text>
								<!-- <view v-if="item.add" class="cu-tag radius bg-green light">new</view>
								<view v-else-if="item.reno" class="cu-tag radius bg-red light">bug</view>
								<text v-else-if="item.optimize" class="cu-tag radius bg-blue light">improve</text> -->
							</view>
						</view>
					</view>
				</view>
				<view class="single">
					<view class="info">
						<view class="version"><b>历史版本</b></view>
					</view>
					<view class="sub-info">
						<view v-for="(data, ind) in historyVersionData" :key="ind" :class="ind>0?'padding-top':''">
							<view class="sub-info-single">
								<view class="cont">
									<view class="version"><b><a>{{"V" + data.version}}</a></b></view>
									<view class="date">{{data.date}}</view>
								</view>
								<view class="des" v-if="data.desc && data.desc.length">
									<view>版本更新说明：</view>
									<view v-for="(item,index) in data.desc" :key="index">
										<view>
											<text class="text-bold">{{index + 1}}</text>
											<text v-if="item.add" class="text-green padding-sm">新增</text>
											<text v-else-if="item.reno" class="text-brown padding-sm">修复</text>
											<text v-else-if="item.optimize" class="text-blue padding-sm">优化</text>
											<text>{{item.desc}}</text>
											<!-- <view v-if="item.add" class="cu-tag radius bg-green light">new</view>
											<view v-else-if="item.reno" class="cu-tag radius bg-red light">bug</view>
											<text v-else-if="item.optimize" class="cu-tag radius bg-blue light">improve</text> -->
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</om-page>
</template>

<script>
	import versionData from '@/static/json/versiondata.json'
	const app = getApp();
	export default {
		data() {
			return {
				pageTitle:"版本记录",
				hasNewVersion: false,//是否有新版本
				nowVersion: '',
				newVersion: '',
				nowVersionData: versionData[0],
				historyVersionData: versionData.slice(1)
			};
		},
		methods: {
			
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title: '版本记录'
			});
			let _that = this;
			_that.nowVersion = this.$version
		}
	};
</script>

<style scoped>
	.version-info{
		padding: 5%;
	}
	.version-cont{
		font-size: 12px;
	}
	.single{
		margin-bottom: 25px;
	}
	a{ 
		color: #5697F4;
		font-size: 14px;
	}
	.version{
		float: left;
		font-size: 16px;
	}
	.date{
		float: right;
	}
	.info{
		width: 100%;
		position: relative;
		overflow: hidden;
		margin-bottom: 5px;
	}
	.cont{
		width: 100%;
		position: relative;
		overflow: hidden;
	}
	.sub-info-single{
		margin-bottom: 5px;
	}
</style>
